# -*- encoding=utf8 -*-
__author__ = "taozhen"

from airtest.core.api import *

auto_setup(__file__)

start_app("com.rongyi.launcher")
wait(Template(r"tpl1587968613929.png", record_pos=(-0.08, 0.022), resolution=(1080, 1920)))
touch(Template(r"tpl1587968624073.png", record_pos=(-0.089, 0.024), resolution=(1080, 1920)))
touch(Template(r"tpl1587968660243.png", record_pos=(0.078, 0.157), resolution=(1080, 1920)))
# time.sleep(60)

assert_exists(Template(r"tpl1588217458536.png", record_pos=(-0.01, -0.053), resolution=(1080, 1920)), "判断是否存在正在打包的图案和文字")


# while True:
# try 
# except Exception as e:
    
wait(Template(r"tpl1588216730086.png", record_pos=(0.356, 0.077), resolution=(1080, 1920)),timeout=180)
touch(Template(r"tpl1587968872864.png", record_pos=(0.361, 0.076), resolution=(1080, 1920)))

# 开始测试易拉宝模板

start_app("com.rongyi.elecexhibition")



assert_exists(Template(r"tpl1589252825071.png", record_pos=(-0.215, -0.618), resolution=(1080, 1920)), "验证单图是否存在")
assert_exists(Template(r"tpl1589252844854.png", record_pos=(0.285, -0.739), resolution=(1080, 1920)), "验证文字是否存在")

assert_exists(Template(r"tpl1589252863784.png", record_pos=(0.007, 0.0), resolution=(1080, 1920)), "验证百度网页是否正常展示")

wait(Template(r"tpl1589252998327.png", record_pos=(-0.31, 0.551), resolution=(1080, 1920)),timeout=15)
assert_exists(Template(r"tpl1589253050378.png", record_pos=(-0.317, 0.519), resolution=(1080, 1920)), "验证是否是否存在")

assert_exists(Template(r"tpl1589253095881.png", record_pos=(-0.206, 0.437), resolution=(1080, 1920)), "验证视频是否会播放")


wait(Template(r"tpl1589253170955.png", record_pos=(0.136, 0.525), resolution=(1080, 1920)),timeout=20)
swipe(Template(r"tpl1589253271299.png", record_pos=(0.28, 0.485), resolution=(1080, 1920)), vector=[-0.2437, 0.0366])
assert_exists(Template(r"tpl1589253336073.png", record_pos=(0.123, 0.508), resolution=(1080, 1920)), "查看轮播图是否播放")












